#!/usr/bin/perl
use strict;

open (TEST, ">test.fa") or die;
my $cnt_seq = 0;
for (0..199)
{
	print TEST ">sequence #$cnt_seq\n";
	++$cnt_seq;
	for (0..15)
	{
		print TEST "line $_ ASDFSAFASF\n";
	}
	print TEST "last line ASDFSAFASF\n";
}

system ('fasta_split -p "result.[INDEX].fa" -E 27 -v < test.fa');
print STDERR "\tComparing results...\n";
system ("cat result.*.fa > new.fa");
{
	my @diff = `diff test.fa new.fa`;
	if (@diff != 0)
	{
		print STDERR "FAILED: test.fa new.fa are not the same!\n";
		exit;
	}
}
print STDERR "\tCleaning up...\n";
unlink (glob("*.fa"));
print STDERR "\n\tSUCCESS!!!\n\n";
